﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using BackboneTest.Models;
using BackboneTest.DAL;
using System.Data;
using SystemCommon;

namespace BackboneTest.BLL
{
    public class GuestbookBLL
    {
        GuestbookDAL dal = new GuestbookDAL(SysConfig.DBConstr);
        public GuestbookBLL()
        { }

        #region  成员方法

                
                 /// <summary>
                /// 增加一条数据
                /// </summary>
                public bool Add(Guestbook model)
                {
                    if (dal.Add(model) == -1)
                    {
                        return false;
                    }
                    else
                    {
                        return true;
                    }
                }

                
       
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Guestbook model)
        {
            return dal.Update(model);
        }

        /// <summary>
        /// 删除一条数据
        /// </summary>
        public bool Delete(int intGuestbookID)
        {

            return dal.Delete(intGuestbookID);
        }
        
        /// <summary>
        /// 删除多条数据
        /// </summary>
        public bool Delete(string GuestbookIDs)
        {

            return dal.Delete(GuestbookIDs);
        }

        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Guestbook GetModel(int intGuestbookID)
        {

            return dal.GetModel(intGuestbookID);
        }

        /// <summary>
        /// 获得数据列表
        /// </summary>
        public DataTable GetList(string strWhere)
        {
            return dal.GetList(strWhere);
        }
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public DataTable GetList()
        {
            return dal.GetList();
        }
        
        /// <summary>
        /// 分页列表
        /// </summary>
        /// <param name="GuestbookItem"></param>
        /// <param name="pageSize"></param>
        /// <param name="index"></param>
        /// <param name="Total"></param>
        /// <returns></returns>
        public DataTable GetList(GuestbookItem searchItem, int pageSize, int index, out int Total)
        {
            return dal.GetList(searchItem,pageSize,index,out Total);
        }
        
        /// <summary>
        /// 导入Excel数据
        /// </summary>
        /// <param name="dtExcel"></param>
        /// <returns></returns>
        public bool ExcelToDataBase(DataTable dtExcel)
        {
            return dal.ExcelToDataBase(dtExcel);
        }
        
        #endregion  成员方法
    }
}



